package com.zhcd.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhcd.sys.pojo.Mattess;
import com.zhcd.sys.mapper.MattessMapper;
import com.zhcd.sys.pojo.Patient;
import com.zhcd.sys.service.MattessService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author feifei
 * @since 2021-11-29
 */
@Service
public class MattessServiceImpl extends ServiceImpl<MattessMapper, Mattess> implements MattessService {
    @Autowired
    private MattessMapper mattessMapper;

    //添加床垫
    @Override
    public int ins_Mattess(Mattess mattess) {
        return mattessMapper.insert(mattess);
    }

    //查询全部床垫信息
    @Override
    public List<Mattess> selAll_Mattess() {
        return mattessMapper.selectList(null);
    }

    //条件(设备号、床号)查询床垫信息
    @Override
    public List<Mattess> selList_Mattess(String id) {
        QueryWrapper<Mattess> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("EquipmentNo",id).or().eq("BedNo",id);
        return mattessMapper.selectList(objectQueryWrapper);
    }

    //删除床垫信息
    @Override
    public int del_Mattess(int id) {
        return mattessMapper.deleteById(id);
    }

    //修改床垫信息
    @Override
    public int upd_Mattess(Mattess mattess) {
        return mattessMapper.updateById(mattess);
    }
}
